<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 引入css -->
  <link rel="stylesheet" href="/assets/lib/layui/css/layui.css">
  <link rel="stylesheet" href="/assets/css/base.css">
  <link rel="stylesheet" href="/assets/css/article/articlelist.css">
</head>

<body>
  <!-- 头部区域 面板 -->
  <div class="layui-card">
    <div class="layui-card-header">文章列表</div>
    <div class="layui-card-body">


      <!-- 分类删选框 -->

      <form class="layui-form" action="" id="search">

        <div class="layui-form-item">

          <div class="layui-inline">
            <!-- 这里面style="width: 200px;"中的200px是可以更改的 -->
            <div class="layui-input-inline" style="width: 200px;">
              <select name="category" lay-verify="">
                <option value="">请选择分类</option>
                <!-- 需要发送ajax动态获取 -->
                <!-- 下拉框的模板 -->
              </select>
            </div>
            <div class="layui-input-inline" style="width: 200px;">
              <select name="state" lay-verify="">
                <option value="">请选择状态</option>
                <option value="已发布">已发布</option>
                <option value="草稿">草稿</option>
              </select>
            </div>
          </div>

          <div class="layui-inline">
            <div class="layui-input-inline" style="width: 100px;">
              <button class="layui-btn" lay-submit lay-filter="formDemo">筛选</button>
            </div>
          </div>
        </div>
      </form>


      <!-- 文章标题内容区 -->
      <table class="layui-table">
        <!-- 设置表头的横格数量 -->
        <colgroup>
          <col width="40%">
          <col width="15%">
          <col width="15%">
          <col width="15%">
          <col>
        </colgroup>
        <thead>
          <tr>
            <th>文章标题</th>
            <th>分类</th>
            <th>发表时间</th>
            <th>状态</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <!-- 由js动态添加 -->
          <!-- 文章模板 -->
        </tbody>
      </table>




      <!-- 分页 -->
      <div id="page"></div>
      <!-- 分页结束 -->

    </div>
  </div>


  <!-- 文章模板 -->
  <script type="text/html" id="tpl-list">
    {{ each data}}
    <tr>
      <td>{{$value.title}}</td>
      <td>{{$value.cate_name}}</td>
      <td>{{$value.pub_date}}</td>
      <td>{{$value.state}}</td>
      <td>
        <!-- 给a标签添加这个id是一个精髓 -->
        <a href = '/article/edit.html?id={{$value.Id}}' class="layui-btn layui-btn-xs">编辑</a>
        <button type="button" data-id = '{{$value.Id}}' class="layui-btn layui-btn-xs layui-btn-danger">删除</button>
      </td>
    </tr>
    {{/each}}
  </script>

<!-- 下拉框的模板 -->
<script type="text/html" id="tpl-category">
  {{each data}}
  <option value="{{$value.Id}}">{{$value.name}}</option>
  {{/each}}
</script>


  <!-- 引入js -->
  <script src="/assets/lib/jquery.js"></script>
  <script src="/assets/lib/layui/layui.all.js"></script>
  <!-- 加载模板引擎 -->
  <script src="/assets/lib/template-web.js"></script>
  <!-- 自己的代码 -->
  <script src="/assets/js/common.js"></script>
  <script src="/assets/js/article/articlelist.js"></script>
</body>

</html>